package cn.lopr.im.android.utils;

import cn.lopr.im.android.BuildConfig;

/**
 * apis
 *
 * @author shuangyang7
 * @date 2020/12/19 22:00
 */
public class Apis {

    /**
     * web端api地址
     */
    private static final String API_ADDERS = BuildConfig.API_ADDERS;
    private static final String API_PORT = BuildConfig.API_PORT;
    private static final String API_CONTEXT_PATH = BuildConfig.API_CONTEXT_PATH;

    /**
     * socket 服务端地址
     */
    private static final String SOCKET_ADDRESS = BuildConfig.SOCKET_ADDRESS;
    private static final String SOCKET_PORT = BuildConfig.SOCKET_PORT;

    /**
     * web端api访问URL
     */
    private static final String API_BASE_URL = String.format("http://%s:%s/%s",
            API_ADDERS, API_PORT, API_CONTEXT_PATH);

    public static final String DEPLOY_WS_URL = String.format("ws://%s:%s", SOCKET_ADDRESS, SOCKET_PORT);

    /**
     * Web端api地址
     *
     * @author shuangyang7
     * @date 2021/1/1 16:34
     */
    public enum WebApis {

        TEST_ERROR(0, API_BASE_URL + "/wuss"),
        LOGIN(101, API_BASE_URL + "/user/login"),
        IS_LOGIN(102, API_BASE_URL + "/user/isLogin"),
        GET_FRIEND(103, API_BASE_URL + "/user/getFriend"),
        GET_FRIEND_BY_PHONES(103, API_BASE_URL + "/user/getFriendByPhones"),
        REG(104, API_BASE_URL + "/user/reg"),
        REG_BEFORE(104, API_BASE_URL + "/user/regBefore"),
        GET_USER_INFO(104, API_BASE_URL + "/user/getUserInfo"),
        GET_USER_INFO_BY_ID(104, API_BASE_URL + "/user/getUserInfoById"),
        SEARCH_FRIEND(105, API_BASE_URL + "/user/searchFriend"),
        ADD_FRIEND(106, API_BASE_URL + "/user/addFriend"),
        GET_CODE(107, API_BASE_URL + "/user/getCode"),
        INFO_UPDATE(108, API_BASE_URL + "/user/update"),
        GET_LikeMe_LikeYou_Visit_Publish(111, API_BASE_URL + "/user/getLikeMeLikeYouVisitPublish"),
        GET_OFFLINE_MESSAGE(104, API_BASE_URL + "/message/getOfflineMessage"),
        COS_TEMP_SECRET(109, API_BASE_URL + "/cos/getTempSecret"),
        GET_PLATE(110, API_BASE_URL + "/article/getPlate"),
        GET_ARTICLE_LIST(111, API_BASE_URL + "/article/getArticleList"),
        GET_ARTICLE_LIST_BY_USER_ID(111, API_BASE_URL + "/article/getArticleListByUserId"),
        GET_ARTICLE(111, API_BASE_URL + "/article/getArticle"),
        ADD_ARTICLE(112, API_BASE_URL + "/article/addArticle"),
        UPDATE_ARTICLE(113, API_BASE_URL + "/article/updateArticle"),
        DEL_ARTICLE(114, API_BASE_URL + "/article/delArticle"),
        GET_ARTICLE_COMMENT(115, API_BASE_URL + "/article/getArticleComment"),
        GET_ARTICLE_CHILD_COMMENT(115, API_BASE_URL + "/article/getArticleChildComment"),
        ADD_ARTICLE_COMMENT(116, API_BASE_URL + "/article/addArticleComment"),
        UPDATE_ARTICLE_COMMENT(117, API_BASE_URL + "/article/updateArticleComment"),
        DEL_ARTICLE_COMMENT(118, API_BASE_URL + "/article/delArticleComment"),
        GET_ARTICLE_SHARE(111, API_BASE_URL + "/article/getArticleShare"),
        GET_ARTICLE_LIKE(111, API_BASE_URL + "/article/getArticleLike");

        private final int code;
        private final String value;

        WebApis(int code, String value) {
            this.code = code;
            this.value = value;
        }

        public int getCode() {
            return code;
        }

        public String getValue() {
            return value;
        }
    }
}
